<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Mr.UBKey
 * Date: 27/10/2011
 * Time: 14:17
 * To change this template use File | Settings | File Templates.
 */
#[Table('slide')]
#[PrimaryKey('id')]
class Areas_Slide_Models_Slide extends XPHP_Model
{
    #[Command(insert = false, update = false)]
    public $id;

    #[Label('Tiêu đề')]
    public $title;

    #[Label('Mổ tả')]
    public $description;

    #[Label('Ảnh')]
    public $image;

    public $type;

    #[Label('Thứ tự')]
    public $sort;

    /**
     * Lấy ra danh sách các ảnh slide
     * @param $type Loại slide
     * @return void
     */
    public function getSlides($type)
    {
        $result = $this->db->where('type', $type)
                           ->order_by('sort', 'asc')
                           ->get()
                           ->result();
        return $result;
    }
}
